<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * 工具类
<span class='line'>  3</span>  * @class
<span class='line'>  4</span>  */</span><span class="WHIT">
<span class='line'>  5</span> </span><span class="PUNC">;</span><span class="NAME">FDLib.util</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>  6</span> </span><span class="WHIT">	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>  7</span> </span><span class="WHIT">    </span><span class="NAME">OP</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object.prototype</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>  8</span> </span><span class="WHIT">    </span><span class="NAME">ARRAY_TOSTRING</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'[object Array]'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>  9</span> </span><span class="WHIT">    </span><span class="NAME">FUNCTION_TOSTRING</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'[object Function]'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 10</span> </span><span class="WHIT">    </span><span class="NAME">doc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="WHIT">   </span><span class="WHIT">
<span class='line'> 12</span> </span><span class="WHIT">    </span><span class="NAME">HTML_CHARS</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="WHIT">        </span><span class="STRN">'&'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&amp;'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT">        </span><span class="STRN">'&lt;'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&lt;'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">        </span><span class="STRN">'>'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&gt;'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="WHIT">        </span><span class="STRN">'"'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&quot;'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT">        </span><span class="STRN">"'"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&#x27;'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT">        </span><span class="STRN">'/'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&#x2F;'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT">        </span><span class="STRN">'`'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&#x60;'</span><span class="WHIT">
<span class='line'> 20</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 24</span> 		 * 是否为数组
<span class='line'> 25</span> 		 * @return 是返回true
<span class='line'> 26</span> 		 */</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">		</span><span class="NAME">isArray</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">OP.toString.apply</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">ARRAY_TOSTRING</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 31</span> 		 * 是否为布尔类型
<span class='line'> 32</span> 		 * @return 是返回true
<span class='line'> 33</span> 		 */</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">		</span><span class="NAME">isBoolean</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'boolean'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 38</span> 		 * 是否为函数类型
<span class='line'> 39</span> 		 * @return 是返回true
<span class='line'> 40</span> 		 */</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT">		</span><span class="NAME">isFunction</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">OP.toString.apply</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">FUNCTION_TOSTRING</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 45</span> 		 * 是否为空
<span class='line'> 46</span> 		 * @return 是返回true
<span class='line'> 47</span> 		 */</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">		</span><span class="NAME">isNull</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 52</span> 		 * 是否为数字类型
<span class='line'> 53</span> 		 * @return 是返回true
<span class='line'> 54</span> 		 */</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">		</span><span class="NAME">isNumber</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">isFinite</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 59</span> 		 * 是否为对象
<span class='line'> 60</span> 		 * @return 是返回true
<span class='line'> 61</span> 		 */</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">		</span><span class="NAME">isObject</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.isFunction</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 66</span> 		 * 是否为字符串
<span class='line'> 67</span> 		 * @return 是返回true
<span class='line'> 68</span> 		 */</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">		</span><span class="NAME">isString</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 73</span> 		 * 是否为undefined
<span class='line'> 74</span> 		 * @return 是返回true
<span class='line'> 75</span> 		 */</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">		</span><span class="NAME">isUndefined</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 80</span> 		 * 转换HTML码,即&gt;转成'&gt;'
<span class='line'> 81</span> 		 */</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">		</span><span class="NAME">escapeHTML</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">html</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">html.replace</span><span class="PUNC">(</span><span class="REGX">/[&&lt;>"'\/`]/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">				</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">match</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">					</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">HTML_CHARS</span><span class="PUNC">[</span><span class="NAME">match</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'> 89</span> 		 * 拷贝数据,c拷贝到o
<span class='line'> 90</span> 		 * @param o 原数据
<span class='line'> 91</span> 		 * @param c 拷贝的数据
<span class='line'> 92</span> 		 * @return 返回o
<span class='line'> 93</span> 		 */</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">		</span><span class="PUNC">,</span><span class="NAME">apply</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">		 </span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">		    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">		        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">		            </span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">		        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">		    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">		    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>103</span> 		 * 克隆一个对象
<span class='line'>104</span> 		 * @param obj 可以是json数据,也可以是array
<span class='line'>105</span> 		 */</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">		</span><span class="PUNC">,</span><span class="NAME">clone</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">buf</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">		    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.isObject</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">   </span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">		        </span><span class="NAME">buf</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">   </span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">		        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">   </span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">		            </span><span class="NAME">buf</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.clone</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">   </span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">		        </span><span class="PUNC">}</span><span class="WHIT">   </span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">		    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.isArray</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">   </span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">		        </span><span class="NAME">buf</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">		        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">obj.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">		        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">		        	</span><span class="NAME">buf</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.clone</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">		        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>119</span> </span><span class="WHIT">		    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">   </span><span class="WHIT">
<span class='line'>120</span> </span><span class="WHIT">		       </span><span class="NAME">buf</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">		    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">		    </span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">		    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">buf</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>124</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>126</span> 		 * 遍历数组,执行操作
<span class='line'>127</span> 		 * @param arr 数组
<span class='line'>128</span> 		 * @param callback 回调函数,第一个参数为数组中的元素,第二个是数组索引&lt;br>
<span class='line'>129</span> 		 * 如果callback函数返回一个不是undefined类型的数据那么整个循环就结束,如:return false,return "111".
<span class='line'>130</span> 		 * 
<span class='line'>131</span> 		 * @return 如果callback有返回确切的值,则该each返回那个值,否则返回undefined
<span class='line'>132</span> 		 */</span><span class="WHIT">
<span class='line'>133</span> </span><span class="WHIT">		</span><span class="PUNC">,</span><span class="NAME">each</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">arr</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>134</span> </span><span class="WHIT">			</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">len</span><span class="PUNC">=</span><span class="NAME">arr.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>135</span> </span><span class="WHIT">				</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ret</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">arr</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>136</span> </span><span class="WHIT">				</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">FDLib.util.isUndefined</span><span class="PUNC">(</span><span class="NAME">ret</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">					</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">ret</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>142</span> 		 * 格式化长度值,如'100px'变为100
<span class='line'>143</span> 		 * @return 返回int型的值
<span class='line'>144</span> 		 */</span><span class="WHIT">
<span class='line'>145</span> </span><span class="WHIT">		</span><span class="PUNC">,</span><span class="NAME">formatSize</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">size</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">size.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/\D*/g</span><span class="PUNC">,</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>149</span> 		 * 返回长度值,如100px
<span class='line'>150</span> 		 */</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">		</span><span class="PUNC">,</span><span class="NAME">getPX</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">size</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT">			</span><span class="NAME">size</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.formatSize</span><span class="PUNC">(</span><span class="NAME">size</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">size</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">size</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">				</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">size</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'px'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>159</span> 		 * 读cookie
<span class='line'>160</span> 		 * var name = FDLib.util.readCookie("myCookie")
<span class='line'>161</span> 		 * @param name cookie名
<span class='line'>162</span> 		 */</span><span class="WHIT">
<span class='line'>163</span> </span><span class="WHIT">		</span><span class="PUNC">,</span><span class="NAME">readCookie</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>164</span> </span><span class="WHIT">		    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cookieValue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">		    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">search</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"="</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">		    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">document.cookie.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">		        </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.cookie.indexOf</span><span class="PUNC">(</span><span class="NAME">search</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT">		        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>169</span> </span><span class="WHIT">		            </span><span class="NAME">offset</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">search.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">		            </span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.cookie.indexOf</span><span class="PUNC">(</span><span class="STRN">";"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">offset</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">		            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">end</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.cookie.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> </span><span class="WHIT">		            </span><span class="NAME">cookieValue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">unescape</span><span class="PUNC">(</span><span class="NAME">document.cookie.substring</span><span class="PUNC">(</span><span class="NAME">offset</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">end</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>173</span> </span><span class="WHIT">		        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>174</span> </span><span class="WHIT">		    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>175</span> </span><span class="WHIT">		    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">cookieValue</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>176</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>177</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>178</span> 		 * 写cookie
<span class='line'>179</span> 		 * FDLib.util.writeCookie("myCookie", "my name", 24);
<span class='line'>180</span> 		 * @param name cookie名
<span class='line'>181</span> 		 * @param value cookie值
<span class='line'>182</span> 		 * @param hours 有效时间,小时
<span class='line'>183</span> 		 */</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT">		</span><span class="PUNC">,</span><span class="NAME">writeCookie</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">hours</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>185</span> </span><span class="WHIT">		    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">expire</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT">		    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hours</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT">		        </span><span class="NAME">expire</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hours</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NUMB">3600000</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>188</span> </span><span class="WHIT">		        </span><span class="NAME">expire</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"; expires="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">expire.toGMTString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>189</span> </span><span class="WHIT">		    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT">		    </span><span class="NAME">document.cookie</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"="</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">escape</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">expire</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>191</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>192</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>193</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>194</span> </span></pre></body></html>